#ifndef HTTPREQEUSTTASK_H
#define HTTPREQEUSTTASK_H


#include <QRunnable>
#include <QTcpSocket>
#include <QTextStream>
#include <QDebug>
#include <QThread>
#include <QJsonDocument>
#include <QJsonObject>
#include <QSqlQuery>
#include <QJsonArray>




class HttpRequestTask : public QRunnable
{
public:
    //explicit HttpRequestTask(QTcpSocket *socket);
    explicit HttpRequestTask(qintptr descriptor);

    void run() override;
private:
    QTcpSocket *socket;
    qintptr socketDescriptor;  // 仅传递描述符
    void processRequest();
    void safeCloseSocket();

    void LoginReplay(const QByteArray & postData);
    void ReplaySuccess( const QJsonObject & jsResult);
    void ReplayFailNotFound();

    void GetPersonInfoListReplay(const QByteArray & postData);
    bool isJsonInt(const QJsonValue &value);
};

#endif // HTTPREQEUSTTASK_H
